Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tap-parser

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tap-parser

parse the test anything protocol

  • 13.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is tap-parser?

The tap-parser npm package is a TAP (Test Anything Protocol) parser for Node.js. It allows you to parse TAP output, which is a standard format for test results, and provides a way to handle the parsed data programmatically.

What are tap-parser's main functionalities?

Parsing TAP output

This feature allows you to parse TAP output and handle assertions and results. The code sample demonstrates how to create a parser instance, listen for 'assert' and 'complete' events, and parse a simple TAP string.

const Parser = require('tap-parser');
const parser = new Parser();

parser.on('assert', assert => {
  console.log('assertion:', assert);
});

parser.on('complete', results => {
  console.log('results:', results);
});

parser.end('TAP version 13
ok 1 - this is fine
not ok 2 - this is not fine
1..2
');

Handling TAP comments

This feature allows you to handle comments in TAP output. The code sample demonstrates how to listen for 'comment' events and parse a TAP string that includes a comment.

const Parser = require('tap-parser');
const parser = new Parser();

parser.on('comment', comment => {
  console.log('comment:', comment);
});

parser.end('TAP version 13
# this is a comment
ok 1 - this is fine
');

Handling TAP plan

This feature allows you to handle the TAP plan, which specifies the number of tests expected. The code sample demonstrates how to listen for 'plan' events and parse a TAP string that includes a plan.

const Parser = require('tap-parser');
const parser = new Parser();

parser.on('plan', plan => {
  console.log('plan:', plan);
});

parser.end('TAP version 13
1..2
ok 1 - this is fine
ok 2 - this is also fine
');

Other packages similar to tap-parser

Keywords

FAQs

Package last updated on 20 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc